﻿using System;
using System . Collections . Generic;
using System . Linq;
using System . Text;
using System . Threading . Tasks;
using System . Globalization;

namespace OrangeEndless
{
	public class Technology
	{
		public string Name { get; set; }

		public string Introduction { get; set; }

		public string Id { get; set; }

		public bool IsPromoted { get; set; }

		public Func<Task> ToDoWhenPromote { get; set; }

		public Func<bool> CanPromote { get; set; }

		public async Task<bool> Promote ( )
		{
			if ( CanPromote ( ) )
			{
				await ToDoWhenPromote ( );
				return true;
			}
			else
			{
				return false;
			}
		}

		public void Suspend ( )
		{
			Properties . Settings . Default [ Id + "IsPromoted" ] = IsPromoted;
		}

		public static Task<Technology> LoadTechnology ( int key )
		{
			return Task . Run ( ( ) =>
			{
				string id =( "T" + key . ToString ( CultureInfo . InvariantCulture ) );
				var Temp=new Technology
				{

				};
				return Temp;
			} );
		}
	}
}
